package com.zl.tesseract.scanner.greendao;

import android.database.sqlite.SQLiteDatabase;

import com.zl.tesseract.scanner.app.MyApplication;
import com.zl.tesseract.scanner.greendao.db.DaoMaster;
import com.zl.tesseract.scanner.greendao.db.DaoSession;

/**
 * @author: create by bb
 * time：2019/4/26 11:42
 */
public class GreenDaoHelper {
    private static DaoMaster daoMaster;
    private static DaoMaster.DevOpenHelper mHelper;
    private static SQLiteDatabase mDb;
    private static DaoMaster mDaoMaster;
    private static DaoSession mDaoSession;

    /**
     * 设置greenDao
     */
    public static void initDatabase() {

        mHelper = new DaoMaster.DevOpenHelper(MyApplication.sAppContext, "scanner.db", null);
        mDb = mHelper.getWritableDatabase();
        mDaoMaster = new DaoMaster(mDb);
        mDaoSession = mDaoMaster.newSession();
    }

    public static DaoSession getDaoSession() {
        return mDaoSession;
    }

    public static SQLiteDatabase getDb() {
        return mDb;
    }


}
